// pages/face/face.js
const app = getApp()
Page({
  data: {
  },
  onLoad: function (res) {
  },
  record() {
    var fg= wx.createCameraContext()
    fg.takePhoto({
      quality: 'high', //高质量的图片
      // device-position:'front',
      success: res => {
        //res.tempImagePath照片文件在手机内的的临时路径
        let tempImagePath = res.tempImagePath
        
        app.api.imgUpload(tempImagePath).then(res => {
          let iurl = res.imageurl;

          app.api.faceUpdate({userid:app.globalData.userInfo.userid, faceurl: iurl}).then(res => {
            wx.navigateBack();
          })
        })
      }
    })
  },
})